<template>
  <div class="yh-layout-box mt-20 x-list" v-if="list && list.length > 0">
    <div class="x-list-items">
      <router-link :to="{ name: 'SearchXorderDetail', params: {id: item.id} }" class="x-item" v-for="(item, index) in list" :key="index">
        <div class="x-pic">
          <img src="@/assets/images/xorder/shop-xlist-icon.png">
        </div>
        <div class="x-content">
          {{ item.templateName }}
        </div>

        <div class="x-read"> <img src="@/assets/images/xorder/home-xlist-read.png"> {{ item.readNum }}人</div>
        <div class="x-date">备货时间{{ item.stockupTime }}天</div>
      </router-link>
    </div>

    <router-link class="x-list-more" :to="{ name: 'SearchXorder', params: {} }">
      更多 >
    </router-link>
  </div>
</template>

<script>
import { getOpenList } from '@/api/xorder'
export default {
  data() {
    return {
      list: null,
      factoryId: this.$route.params.factoryId,
    }
  },
  created() {
    this.getOpenList();
  },
  methods: {
    getOpenList() {
      getOpenList({
        page: 1,
        size: 2,
        factoryId: this.factoryId
      }).then(res=>{
        this.list = res.data.list
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.x-list{
  margin-top: 30px;
  margin-bottom: 30px;
  height: 60px;
  .x-list-more{
    width: 60px;
    text-align: center;
    margin-bottom: 10px;
    display: block;
    text-decoration: none;
    color: #999999;
    float: right;
    line-height: 60px;
    transition: all 0.3s;
    &:hover{
      color: #255B8B;
    }
  }
  .x-list-items{
    float: left;
    width: 1140px;
    .x-item{
      float: left;
      padding: 10px 20px;
      width: 520px;
      box-shadow:0px 4px 10px 0px rgba(0, 0, 0, 0.1);
      background-color: rgba(255,255,255,0.6);
      border-radius: 50px;
      transition: all 0.3s;
      &:hover{
        box-shadow:0px 4px 10px 0px rgba(0, 0, 0, 0.2);
        background-color: #FFFFFF;
      }
      .x-content{
        color: #333333;
        width: 225px;
        height: 40px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        float: left;
        margin-left: 20px;
        line-height: 40px;
      }
      .x-pic{
        float: left;
        width: 40px;
        height: 40px;
      }

      .x-read{
        float: right;
        text-align: right;
        color: #255B8B;
        font-size: 14px;
        line-height: 40px;
        img{
          vertical-align: middle;
          margin-top: -4px;
        }
      }
      .x-date{
        float: right;
        margin-right: 20px;
        line-height: 40px;
        color: #333333;
      }
      .x-info{
        float: left;
        margin-left: 20px;
        .x-head{
          overflow: hidden;
          margin-bottom: 24px;
          h3{
            float: left;
            padding: 0;
            font-size: 18px;
            font-weight: 500;
            margin: 0;
            color: #255B8B;
          }
        }

        .x-foot{
          overflow: hidden;
          color: #888888;
          .x-shop{
            float: left;
            width: 330px;
            overflow: hidden;
            height: 20px;
            display: block;
            text-overflow: ellipsis;
            white-space: nowrap;
            img{
              width: 14px;
              height: 14px;
              overflow: hidden;
              border-radius: 20px;
              vertical-align: middle;
              margin-top: -2px;
              margin-right: 4px;
            }
          }
        }
      }
    }
    .x-item:nth-child(1){
      margin-right: 20px;
    }
  }
}
</style>
